﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;


public partial class xiaoshoutuihuo : System.Web.UI.Page
{
    private static string sqlconn = System.Configuration.ConfigurationManager.AppSettings["sqlcon"].ToString().Trim();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Binddate();
        

        }
    }
    protected void Binddate()
    {
        users us = new users();
        gvxiaoshou.DataSource = us.GetAllxiaoshou(us);
        gvxiaoshou.DataBind();
    }
    protected void gvjinhuo_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gvxiaoshou.PageIndex = e.NewPageIndex;
        Binddate();
    }
  
    
          protected void chkAll_CheckedChanged(object sender, EventArgs e)
    {
        CheckBox chkAll = (CheckBox)sender;
        foreach (GridViewRow gvRow in gvxiaoshou.Rows)
        {
            CheckBox chkItem = (CheckBox)gvRow.FindControl("chkItem");
            chkItem.Checked = chkAll.Checked;
        }
  
    }

          protected void Button1_Click(object sender, EventArgs e)
          {
              foreach (GridViewRow gvRow in gvxiaoshou.Rows)
              {
                  CheckBox chkItem = (CheckBox)gvRow.FindControl("chkItem");

                  if (chkItem.Checked == true)
                  {
                      string id = gvxiaoshou.DataKeys[0].Value.ToString().Trim();
                      users us = new users();
                      us.id = id;
                      us.Deletexiaoshou(us);
                      Binddate();
                  }
              }
          }
}